﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;

namespace Main
{

    
    /// <summary>
    /// 保存客户端数据对象
    /// </summary>
    class ClientHolder
    {
        private Socket socket;

        public ClientHolder(Socket socket)
        {
            this.socket = socket;
        }


        public Socket Socket
        {
            get
            {
                return socket;
            }
        }

        /// <summary>
        /// 客户端线程数量
        /// </summary>
        public int ThreadNum { get; set; }

        /// <summary>
        /// 客户端编号
        /// </summary>
        public string ID { get; set; }

        /// <summary>
        /// 客户端连接状态
        /// </summary>
        public int ConnectionStatus { get; set; }

        public string ConnectionStatusText
        {
            get
            {
                if(this.ConnectionStatus == 0)
                {
                    return "未连接";
                }
                if (this.ConnectionStatus == 1)
                {
                    return "已连接";
                }
                return "未知";
            }
        }


        /// <summary>
        /// 客户端线程状态
        /// </summary>
        public int ThreadStatus { get; set; }

        /// <summary>
        /// 客户端开始验证码
        /// </summary>
        public string CodeFrom { get; set; }

        /// <summary>
        /// 客户端结束验证码
        /// </summary>
        public string CodeTo { get; set; }


        /// <summary>
        /// 客户端当前验证码
        /// </summary>
        public string CurrentCode { get; set; }

        /// <summary>
        /// 客户端验证码结果
        /// </summary>
        public string Result { get; set; }

        /// <summary>
        /// 客户端发过来的指令数据
        /// </summary>
        public CmdData CmdData { get; set; }

        public string ListViewItemKey { get; set; }

        /// <summary>
        /// 将状态信息同步到客户端
        /// </summary>
        public void SyncToClient()
        {

        }

        /// <summary>
        /// 将状态信息更新到列表上对应的行
        /// </summary>
        public void UpdateUI()
        {

        }
    }
}
